package o;

import android.content.Context;
import android.content.Intent;
import android.text.TextUtils;
import androidx.annotation.RequiresApi;
import com.huawei.appgallery.serverreqkit.api.bean.ResponseBean;
import com.huawei.appgallery.serverreqkit.api.bean.startup.StartupResponse;
import com.huawei.appgallery.serverreqkit.api.bean.startup.StartupResponse$OOBEAppInfo;
import com.huawei.appgallery.serverreqkit.api.bean.startup.StartupResponse$OOBEInfos;
import java.util.ArrayList;
import java.util.List;

public class dlv extends dlw {
    private List<StartupResponse$OOBEAppInfo> ˊ = new ArrayList();
    private int ˋ = -1;
    private String ˎ = "";
    private int ॱ = 0;
    private ArrayList<StartupResponse$OOBEAppInfo> ᐝ = new ArrayList();

    public dlv(Context context, int i) {
        super(context);
        this.ॱ = i;
    }

    @RequiresApi(api = 21)
    protected cvt ˏ() {
        int i = 1;
        cvt ˎ = cvv.ˎ();
        ˎ.setServiceType_(0);
        ˎ.ˊ(1);
        ˎ.ᐝ(1);
        ˎ.ˋ(dld.ˎ().ॱˋ());
        ˎ.setLocale_(doi.ॱ());
        Context ˋ = ContentManager.getInstant().getContext();
        if (ˋ != null) {
            this.ˎ = dld.ˎ().ʿ();
            ˎ.ˊ(this.ˎ);
            if (!dli.ᐝ(ˋ)) {
                i = 2;
            }
            ˎ.ॱॱ(i);
            ˎ.ᐝ(dli.ʼ(ˋ));
            ˎ.ॱ(bke.ˎ());
        }
        return ˎ;
    }

    public void notifyResult(BaseRequest o_cvu, ResponseBean responseBean) {
        if (responseBean == null) {
            Logger.ˎ("OOBE", "OOBEGetAppListTask:response is null.");
            ˏ(false);
            return;
        }
        StartupResponse startupResponse = (StartupResponse) responseBean;
        if (startupResponse.getResponseCode() == 0 && startupResponse.getRtnCode_() == 0) {
            startupResponse.ॱˎ();
            List ॱ = startupResponse.ॱ();
            if (!(CollectCheck.isEmpty(ॱ) || ॱ.get(0) == null || ((StartupResponse$OOBEInfos) ॱ.get(0)).ˏ() == null)) {
                this.ˊ = ((StartupResponse$OOBEInfos) ॱ.get(0)).ˏ();
                if (!(((StartupResponse$OOBEInfos) ॱ.get(0)).ˋ() == null || ((StartupResponse$OOBEInfos) ॱ.get(0)).ˋ().isEmpty())) {
                    this.ᐝ.addAll(((StartupResponse$OOBEInfos) ॱ.get(0)).ˋ());
                }
                this.ˋ = ((StartupResponse$OOBEInfos) ॱ.get(0)).ॱ();
                dld.ˎ().ˎ(((StartupResponse$OOBEInfos) ॱ.get(0)).ˎ());
            }
            if (this.ˊ.isEmpty()) {
                ˏ(false);
                return;
            }
            dld.ˎ().ˋ(this.ˋ);
            dld.ˎ().ॱˎ();
            dld.ˎ().ʻॱ().addAll(this.ˊ);
            dld.ˎ().ʽ().addAll(this.ᐝ);
            Context ˋ = ContentManager.getInstant().getContext();
            if (dli.ˏ(ˋ)) {
                dld.ˎ().ॱ(ContentManager.getInstant().getContext());
                ˋ(ˋ);
            }
            if (dli.ˏ(ContentManager.getInstant().getContext())) {
                dkz.ˊ(new dkz(dld.ˎ().ॱˊ(), (StartupResponse$OOBEInfos) ॱ.get(0), dld.ˎ().ʿ()));
                dld.ˋ(true);
            }
            ˏ(true);
            return;
        }
        ˏ(false);
        Logger.e("OOBE", "OOBEGetAppListTask failed. responseCode=" + startupResponse.getResponseCode() + " returnCode=" + startupResponse.getRtnCode_());
    }

    private void ˋ(Context context) {
        if (!dld.ˎ().ʼ().isEmpty() && !TextUtils.isEmpty(dld.ˎ().ॱˊ())) {
            for (StartupResponse$OOBEAppInfo startupResponse$OOBEAppInfo : dld.ˊ(context, dld.ˎ().ʼ())) {
                if (!dof.ˋ(startupResponse$OOBEAppInfo.ʼ())) {
                    eqx.ˋ(context, startupResponse$OOBEAppInfo.ʼ());
                }
            }
        }
    }

    private void ˏ(boolean z) {
        Intent intent = new Intent("com.huawei.appmarket.oobe.ACTION_GET_APPLIST_FINISHED");
        intent.putExtra("resultOk", z);
        intent.putExtra("fromWhere", this.ॱ);
        ll.ˏ(ContentManager.getInstant().getContext()).ˋ(intent);
        Logger.ˎ("OOBE", "OOBEGetAppListTask: result =" + z + ", fromWhere=" + this.ॱ);
    }
}
